import { createStore } from 'vuex'

declare let SessionStorage:any;
const USER="USER";

const store=createStore({
    state: {
        user:SessionStorage.get(USER) || {}
    },
    mutations: {
        setUser:(state,user)=>{
            state.user=user
            SessionStorage.set(USER,user)
        },
        SET_TOKEN: (state, token) => {
            // @ts-ignore
            state.token = token
            sessionStorage.setItem("token", token)
        }
    },
    actions: {
    },
    modules: {
    }
})
export default store